<?= form_open('index.php/rmis/management/researchesAction')?>
<div class="col-xs-9">
	<table border=".5">
		<tr><th>NAME</th>
		<th>DEPARTMENT</th>
		<th>RESEARCH TITLE</th>
		<?php 

			if(isset($msg)){
				echo "<tr><td colspan = \"3\">".$msg."</td></tr>";
			}
			else {
				if($stat == "grant view"){
					echo "<th>REQUEST DATE</th>";
					echo "<th></th></tr>";

					$i = 0;
					foreach ($view as $v) {
						echo "<tr><td>";
						echo $v['Name'];
						echo "</td><td>";
						switch ($v['Res_Department']) {
							case 'CS':
								echo "COMPUTER SCIENCE";
								break;
							
							case 'IT':
								echo "INFORMATION TECHNOLOGY";
								break;

							case 'IS':
								echo "INFORMATION SCIENCE";
								break;
						}

						echo "</td><td>";
						echo $v['Res_Title'];

						echo "</td><td>".date("M d, Y ga",strtotime($v['Vw_Date_Requested']))."</td><td>";
						echo "<button name='AGrant' type='submit' 
							value='".$v['Res_ID']."*".$v['Acc_ID']."*".$v['Vw_Date_Requested']."' 
							onclick='return confirm(\"Are you sure you want to allow this view request?\")'>
							Allow</button>";
						echo " <button name='RGrant' type='submit' 
							value='".$v['Res_ID']."*".$v['Acc_ID']."*".$v['Vw_Date_Requested']."' 
							onclick='return confirm(\"Are you sure you want to reject this this view request?\")'>
							Reject</button></td>";
						echo "</td></tr>";
					}
				} else {
					echo "<th>GRANT DATE</th>";
					echo "<th></th></tr>";
				}
		
			}
		?>
	</table>
</div>
<?= form_close()?>